<template>
	<view class="active">
		<swiper class="swiper" 
			circular 
			:indicator-dots="indicatorDots" 
			:autoplay="autoplay" 
			:interval="interval"
			:duration="duration">
			<swiper-item v-for="(item,index) in banner" :key="index">
				<view class="swiper-item">
					<image :src="item.url" mode="aspectFill"></image>
				</view>
			</swiper-item>
		</swiper>
		<div class="nav_tab">
			<div :class="['nav_tab_item',navKey==item.id ? 'active_tab' : '']" v-for="item in navList" :key="item.id" @click="changeTab(item)"> 
				{{ item.name }}
			</div>
		</div>
		<div class="member_list" v-if="!navKey&&memberList.length">
			<div class="member_item" v-for="(item,index) in memberList" :key="index">
				<div class="member_card">
					<img class="member_avatar" :src="item.avatar" alt="">
					<div class="member_info">
						<div class="member_name">
							<div class="member_name_text">{{ item.name }}</div>
							<div class="member_name_verify" v-if="item.hasVerify">
								<span class="icon_verify iconfont icon-renzhengdunpaianquanbaozhangzhibao"></span>
								<span class="name">已实名</span>
							</div>
						</div>
						<div class="member_age_kg">
							<span class="member_age_text">{{ item.mainInfo?.age}}</span><span class="line">|</span>
							<span class="member_age_text">{{ item.mainInfo?.height}}</span><span class="line">|</span>
							<span class="member_age_text">{{ item.mainInfo?.degree}}</span><span class="line">|</span>
							<span class="member_age_text">{{ item.mainInfo?.income}}</span>
						</div>
					</div>
				</div>
				<div class="member_intro van-multi-ellipsis--l3">{{ item.internalMonologue }}</div>
				<div class="member_photos" v-if="item.photos?.length">
					<div class="photo_title">更新了相册</div>
					<div class="photo_list">
						<img class="item_photo" :src="v" alt="" v-for="(v,index) in item.photos" :key="index">
					</div>
				
				</div>
				<div class="member_bottom">
					<div class="member_timer">1天前</div>
					<div class="member_friend">
						<div class="say_hi" @click="sayHi">
							<van-icon name="smile" />
							<label>认识Ta</label>
						</div>
						<div class="matchmaker_match last_meb" @click="help">
							<van-icon name="phone-circle" />
							<label>月老牵线</label>
						</div>
					</div>
				</div>
				<template v-if="index != memberList?.length-1">
					<van-divider />
				</template>
				
			</div>
		</div>
		<div class="match_maker" v-else>
			<div class="match_marker_recommond" v-for="(item,index) in matchMarkeList" :key="index">
				<div class="match_marker_info">
					<div class="match_marker_info_l">
						<img class="match_marker_avatar" :src="item.avatar" alt="">
						<label class="match_marker_name">{{ item.name }}</label>
						<div class="official_web">官方</div>
					</div>
					<div class="match_marker_info_r" @click="callMatch">联系月老</div>
				</div>
				<div class="match_marker_appraise van-multi-ellipsis--l3"></div>
				<div class="member_card">
					<div class="member_card_l">
						<img class="member_avatar" :src="item.recommodedPerson.avatar" alt="">
						<div class="member_info">
							<div class="member_name">
								<div class="member_name_text">{{ item.recommodedPerson.name }}</div>
								<div class="member_name_verify" v-if="item.recommodedPerson.hasVerify">
									<span class="icon_verify iconfont icon-renzhengdunpaianquanbaozhangzhibao"></span>
									<span class="name">已实名</span>
								</div>
							</div>
							<div class="member_age_kg">
								<span class="member_age_text">{{ item.recommodedPerson?.age}}</span><span class="line">|</span>
								<span class="member_age_text">{{ item.recommodedPerson?.height}}</span><span class="line">|</span>
								<span class="member_age_text">{{ item.recommodedPerson?.degree}}</span><span class="line">|</span>
								<span class="member_age_text">{{ item.recommodedPerson?.job}}</span>
							</div>
						</div>
					</div>
					<van-icon class="arrow_icon" name="arrow" @click="goDetail(item)" />
				</div>
				<div class="match_marker_timer">1天前</div>
				<van-divider />
			</div>
		</div>
	</view>
</template>

<script setup>
	import {ref,reactive,onMounted} from 'vue'
  const isScrollTop = ref(false);
  const indicatorDots = ref(false);
  const isWatch = ref(false);
  const autoplay = ref(false);
  const showShare = ref(false);
  const interval = ref('3000');
  const duration = ref('500');
  const navKey = ref(0);
	const banner = reactive([
    {url:'/static/txn.jpeg'},
		{url:'/static/txw.jpeg'},
  ])
	const navList = reactive([
		{id:0,name:'全部'},
		{id:1,name:'月老'},
	])
	const memberInfo = reactive({
		id:0,
		name:'李红',
		avatar:'/static/txn.jpeg',
		hasVerify:1,
		mainInfo:{
			age:'32岁',
			height:'160cm',
			income:'5000-8000',
			degree:'大专'
		},
		photos:[
			'/static/txn.jpeg',
			'/static/txw.jpeg',
		],
		internalMonologue:`他想象研究对象的内心独白：“直到我说出自己似乎好些了，才知道我似乎真的已经好些了。我一定要好起来。”
			He imagines a subject's internal monologue: "I didn't know I seemed to be getting better until I said I seemed to be getting better. I must be getting better."`
	})
	const memberList = reactive([])
	const matchMaker = reactive({
		id:0,
		avatar:'/static/txn.jpeg',
		name:'月老牵线-孙悟空',
		recommodedPerson:{
			name:'网红',
			hasVerify:1,
			age:'20岁',
			height:'178cm',
			degree:'本科',
			job:'护士',
			avatar:'/static/txw.jpeg',
		}
	})
	const matchMarkeList = reactive([])
	const changeTab = item=>{
		navKey.value = item.id
	}
	const sayHi = ()=>{}
	const help = ()=>{}
	const callMatch = ()=>{
		
	}
	const goDetail = (item)=>{
		uni.navigateTo({
			url:`/mysub/detail/index?recommond=true&id=${item.id}`
		})
	}
	
	onMounted(()=>{
		let arr = new Array(20).fill(memberInfo);		
		arr.forEach((item,index)=>{
			item.id = index;
			memberList.push(item);
		})
		new Array(20).fill(matchMaker).forEach((item,index)=>{
			item.id = index;
			matchMarkeList.push(item);
		})
	})
</script>

<style lang="scss" scoped>
@mixin flexC{
	display: flex;
	align-items: center;
}
.active{
	padding:0 30rpx 10rpx;
  background-color: #f7f7f7;
  .swiper{
    margin:10rpx 0;
    height: 320rpx;
    .swiper-item{
      height: 100%;
      width: 100%;
      overflow: hidden;
      border-radius: 10rpx;
      image{
        width: 100%;
        height: 100%;
      }
    }
  }
	.nav_tab{
		height: 80rpx;
		display: flex;
		align-items: center;
		.nav_tab_item{
			font-size: 28rpx;
			color: #666;
			margin-right: 50rpx;
		}
		.active_tab{
			position: relative;
			z-index: 1;
			&::after{
				content: '';
				position: absolute;
				width: 100%;
				height:10rpx;
				background-color: #1c6ad7;
				opacity: 0.8;
				bottom: 0;
				left: 0;
				border-radius: 5rpx;
			}
		}
	}
	.member_list{
		padding:30rpx;
		background-color: #fff;
		border-radius: 10rpx;
		.member_item{
			.member_card{
				display: flex;
				.member_avatar{
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
					margin-right: 20rpx;
				}
				.member_info{
					margin-bottom: 10rpx;
					.member_name{
						display: flex;
						.member_name_text{
							font-size: 26rpx;
							margin-right: 10rpx;
							color: #000;
						}
						.member_name_verify{
								border-radius: 15rpx;
								height: 30rpx;
								padding: 0 8rpx;
								box-sizing: border-box;
								display: inline-flex;
								align-items: center;
								font-size: 20rpx;
								background-color: #1c6ad7;
								color: #fff;
								.icon_verify{
									font-size: 20rpx;
								}
								.name{
									margin-left: 4rpx;
								}
								
						}
					}
					.member_age_kg{
						color: #ccc;
						.member_age_text{
							font-size: 24rpx;
						}
						.line{
							margin:0 20rpx;
							font-size: 30rpx;
						}
					}
				}

			}
			.member_intro{
				font-size: 28rpx;
				line-height: 40rpx;
				color: #000;
			}
			.member_photos{
				.photo_title{
					margin-top: 20rpx;
					font-size: 28rpx;
					color: #000;
					margin-bottom: 20rpx;
				}
				.photo_list{
					display: flex;
					.item_photo{
						height: 180rpx;
						width: 180rpx;
						border-radius: 10rpx;
						margin-right: 20rpx;
						margin-bottom: 20rpx;
					}
				}
				
				
			}
			.member_bottom{
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.member_timer{
					font-size: 28rpx;
					color: #ccc;
				}
				.member_friend{
					display: flex;
					.say_hi,.matchmaker_match{
						margin-left: 10rpx;
						padding: 0 20rpx;
						height: 50rpx;
						border-radius: 30rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						font-size: 28rpx;
						color: #FF6684;
						background-color: #fff;
						border:1px solid #FF6684; 
						label{
							margin-left: 10rpx;
						}
					}
					.last_meb{
						margin-left: 20rpx;
						color: #fff;
						background-color: #FF6684;
					}
				}
			}
		}
	}
	.match_maker{
		padding:30rpx;
		background-color: #fff;
		border-radius: 10rpx;
		.match_marker_recommond{
			.match_marker_info{
				display: flex;
				align-items: center;
				justify-content: space-between;
				.match_marker_info_l{
					@include flexC;
					.match_marker_avatar{
						width: 80rpx;
						height: 80rpx;
						border-radius: 50%;
						margin-right: 20rpx;
					}
					.match_marker_name{
						font-size: 36rpx;
						color: #000;
						margin-right: 10rpx;
					}
					.official_web{
						padding: 0 10rpx;
						box-sizing: border-box;
						height: 30rpx;
						font-size: 20rpx;
						border-radius: 8rpx;
						color: #fff;
						background-color: #1c6ad7;
					}
				}
				.match_marker_info_r{
					display: flex;
					align-items: center;
					justify-content: center;
					width: 150rpx;
					height: 50rpx;
					border-radius: 40rpx;
					font-size: 28rpx;
					color: #fff;
					background-color: #1c6ad7;
					border:1px solid #ccc;
				}
			}
			.match_marker_appraise{
				font-size: 28rpx;
				line-height: 40rpx;
				color: #000;
			}
			.member_card{
				margin-top: 20rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				background-color: #F7F7F7;
				padding:20rpx;
				border-radius: 10rpx;
				.member_card_l{
					@include flexC;
					.member_avatar{
						width: 80rpx;
						height: 80rpx;
						border-radius: 50%;
						margin-right: 20rpx;
					}
				.member_info{
					
					.member_name{
						display: flex;
						align-items: center;
						.member_name_text{
							font-size: 26rpx;
							margin-right: 10rpx;
							color: #000;
						}
						.member_name_verify{
								border-radius: 15rpx;
								height: 30rpx;
								padding: 0 8rpx;
								box-sizing: border-box;
								display: inline-flex;
								align-items: center;
								font-size: 20rpx;
								background-color: #1c6ad7;
								color: #fff;
								.icon_verify{
									font-size: 20rpx;
								}
								.name{
									margin-left: 4rpx;
								}
								
						}
					}
					.member_age_kg{
						color: #ccc;
						.member_age_text{
							font-size: 24rpx;
						}
						.line{
							margin:0 20rpx;
							font-size: 30rpx;
						}
					}
				}
				}
				
				.arrow_icon{
					font-size: 28rpx;
					color: #ccc;
				}

			}
			.match_marker_timer{
				margin-top: 10rpx;
				font-size: 28rpx;
				color:#ccc;
			}
		}
		
	}
	
}
</style>
